const Mock = require("mockjs");
const Random = Mock.Random;
const Dictionary = {
  servicesItem: ["视频问诊", "就医协办", "常关心", "体检报告解读"],
  servicesPackage: ["标准服务包A", "人行A会员", "标准服务包B", "Z会员"],
  companyName: ["国贸医疗大数据公司", "人行公司", "厦大小小科技", "巨大农业"],
  expirationDate: ["1年", "6个月", "30天"],
  mockType: ["按钮", "模块", "功能", "栏目"],
  mockSource: ["本系统", "内部链接", "外部链接", "第三方对接"],
  mockStatus: ["已完成", "未开始", "进行中", "已过期"],
  mockTags: ["长期合作", "心血管重点", "糖尿病重点", "即将到期"]
};

/* 订单列表-服务项 */
const orderItemsList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "orderNo": Random.id(),
      "servicesItem": Random.pick(Dictionary.servicesItem),
      "servicesPackage": Random.pick(Dictionary.servicesPackage),
      "status": Random.pick(Dictionary.mockStatus),
      "customer": Random.cname(),
      "phone": "15255555555",
      "source": Random.pick(Dictionary.mockSource),
      "company": Random.pick(Dictionary.companyName),
      "orderTime": Random.datetime("yyyy-MM-dd HH:mm:ss")
    };
    list.push(obj);
  }
  return {
    success: true,
    records: list
  };
};
Mock.mock("/mock/getorderItemsList", orderItemsList);

/* 订单列表-服务项 */
const orderPackagesList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "orderNo": Random.id(),
      "servicesPackage": Random.pick(Dictionary.servicesPackage),
      "status": Random.pick(Dictionary.mockStatus),
      "price": Random.integer(0, 2000),
      "customer": Random.cname(),
      "phone": "15255555555",
      "source": Random.pick(Dictionary.mockSource),
      "company": Random.pick(Dictionary.companyName),
      "orderTime": Random.datetime("yyyy-MM-dd HH:mm:ss")
    };
    list.push(obj);
  }
  return {
    success: true,
    records: list
  };
};
Mock.mock("/mock/getOrderPackagesList", orderPackagesList);

/* 消费记录-服务项 */
const consumeItemsList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "orderNo": Random.id(),
      "servicesItem": Random.pick(Dictionary.servicesItem),
      "servicesPackage": Random.pick(Dictionary.servicesPackage),
      "price": Random.integer(0, 2000),
      "customer": Random.cname(),
      "phone": "15255555555",
      "source": Random.pick(Dictionary.mockSource),
      "company": Random.pick(Dictionary.companyName),
      "consumeTime": Random.datetime("yyyy-MM-dd HH:mm:ss"),
      "orderTime": Random.datetime("yyyy-MM-dd HH:mm:ss")
    };
    list.push(obj);
  }
  return {
    success: true,
    records: list
  };
};
Mock.mock("/mock/getConsumeItemsList", consumeItemsList);

/* 消费记录-服务包 */
const consumePackagesList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "orderNo": Random.id(),
      "servicesPackage": Random.pick(Dictionary.servicesPackage),
      "price": Random.integer(0, 2000),
      "customer": Random.cname(),
      "phone": "15255555555",
      "source": Random.pick(Dictionary.mockSource),
      "company": Random.pick(Dictionary.companyName),
      "consumeTime": Random.datetime("yyyy-MM-dd HH:mm:ss"),
      "orderTime": Random.datetime("yyyy-MM-dd HH:mm:ss")
    };
    list.push(obj);
  }
  return {
    success: true,
    records: list
  };
};
Mock.mock("/mock/getConsumePackagesList", consumePackagesList);
